#include "Zone.h"
#include "Game.h"
#include <cmath>
//=====CONSTRUCTORS
Zone::Zone()
	:Drawable(),
	m_eiCountryID(NULL),
	m_iPopHealthy(0),
	m_iPopInfected(0),
	m_iPopDead(0),
	m_bInfected(false)
{
	for(int i = 0; i < AFFAIR_SIZE	;i++) {m_ebaAffairs[i]	   = false;}
	for(int i = 0; i < SERVICE_SIZE ;i++) {m_ebaServices[i]	   = false;}
	for(int i = 0; i < AFFLICT_SIZE ;i++) {m_ebaAfflictions[i] = false;}
};
Zone::Zone(int ID, int Pop, float Xpos, float Ypos, float Xsca, float YSca)
	:Drawable(Xpos,Ypos,Xsca,YSca,TYPE_ZONE,-1),
	m_eiCountryID	(ID),
	m_bInfected		(false),
	m_bSuccumbed	(false),
	m_bForsaken		(false)
{
	m_iPopTotal		= Pop*2;
	m_iPopHealthy	= m_iPopTotal;
	m_iPopStart		= m_iPopTotal;
	m_iPopInfected	= 0;
	m_iPopDead		= 0;

	for(int i(0); i < ZONE_SIZE;i++)
		m_bInfectables[i] = false;

	switch(ID)	
	{
	case ZONE_KAJHTAI:			
		m_sName	= "Kajh-Tai";						m_eiTextureIndex					= TEX_KAJHTAI;		
		m_iaAfrThreshes[AFR_WALLSUP]		= 80;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 30;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 50;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 10;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 30;	m_iaAfrThreshes[AFR_VACCINE]		= 50;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 20;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 20;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 60;	m_iMilitantMight=20; m_iScienceMight= 5;
		m_bInfectables[ZONE_VALDUTAN]		= true;	m_bInfectables[ZONE_MARIANIYAH]		= true;
		m_bInfectables[ZONE_KHATOUM]		= true;	m_bInfectables[ZONE_VALUSERRH]		= true;
		break;
	case ZONE_KHATOUM:			
		m_sName	= "Khatoum";						m_eiTextureIndex					= TEX_KHATOUM;		
		m_iaAfrThreshes[AFR_WALLSUP]		= 110;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 110;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 110;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 110;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 50;	m_iaAfrThreshes[AFR_VACCINE]		= 80;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 10;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 20;	m_iMilitantMight=10; m_iScienceMight= 5;
		m_bInfectables[ZONE_FAURRIWEST]		= true;	m_bInfectables[ZONE_VALDUTAN]		= true;
		m_bInfectables[ZONE_VERINEAST]		= true;	m_bInfectables[ZONE_KAJHTAI]		= true;
		break;
	case ZONE_AEMPIS:		
		m_sName	= "Aempis";							m_eiTextureIndex					= TEX_AEMPIS;	
		m_iaAfrThreshes[AFR_WALLSUP]		= 30;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 05;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 10;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 00;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 10;	m_iaAfrThreshes[AFR_VACCINE]		= 20;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 20;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 90;	m_iMilitantMight=10; m_iScienceMight= 30;
		m_bInfectables[ZONE_FAURRIEAST]		= true;	m_bInfectables[ZONE_SIASYA]			= true;
		m_bInfectables[ZONE_VALDUTAN]		= true;	m_bInfectables[ZONE_NEGEWEST]		= true;
		break;
	case ZONE_FAURRIEAST:		
		m_sName	= "Faur'riDar'ru East";				m_eiTextureIndex					= TEX_FAURRIEAST;	
		m_iaAfrThreshes[AFR_WALLSUP]		= 50;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 20;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 10;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 40;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 20;	m_iaAfrThreshes[AFR_VACCINE]		= 50;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 40;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 40;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 30;	m_iMilitantMight=20; m_iScienceMight= 15;
		m_bInfectables[ZONE_VALDUTAN]		= true;	m_bInfectables[ZONE_AEMPIS]			= true;
		m_bInfectables[ZONE_FAURRIWEST]		= true;	
		break;
	case ZONE_FAURRIWEST:		
		m_sName	= "Faur'riDar'ru West";				m_eiTextureIndex					= TEX_FAURRIWEST;	
		m_iaAfrThreshes[AFR_WALLSUP]		= 50;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 20;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 10;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 40;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 20;	m_iaAfrThreshes[AFR_VACCINE]		= 50;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 40;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 40;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 30;	m_iMilitantMight=20; m_iScienceMight= 15;
		m_bInfectables[ZONE_VALDUTAN]		= true;	m_bInfectables[ZONE_KHATOUM]		= true;
		m_bInfectables[ZONE_VERINEAST]		= true;	
		break;
	case ZONE_VALDUTAN:			
		m_sName	= "Valdutan";						m_eiTextureIndex					= TEX_VALDUTAN;		
		m_iaAfrThreshes[AFR_WALLSUP]		= 00;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 10;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 30;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 20;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 10;	m_iaAfrThreshes[AFR_VACCINE]		= 40;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 40;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 90;	m_iMilitantMight=30; m_iScienceMight= 20;
		m_bInfectables[ZONE_AEMPIS]			= true;	m_bInfectables[ZONE_FAURRIWEST]		= true;
		m_bInfectables[ZONE_KAJHTAI]		= true;	m_bInfectables[ZONE_FAURRIEAST]		= true;
		m_bInfectables[ZONE_VALUSERRH]		= true;	m_bInfectables[ZONE_KHATOUM]		= true;
		break;
	case ZONE_VERINWEST:		
		m_sName	= "Verin Colonies West";			m_eiTextureIndex					= TEX_VERINWEST;
		m_iaAfrThreshes[AFR_WALLSUP]		= 80;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 20;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 30;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 00;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 10;	m_iaAfrThreshes[AFR_VACCINE]		= 10;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 60;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 40;	m_iMilitantMight=10; m_iScienceMight= 25;
		m_bInfectables[ZONE_VERINCENTER]	= true;	m_bInfectables[ZONE_SANKT]			= true;
		m_bInfectables[ZONE_VERINEAST]		= true;	m_bInfectables[ZONE_NEGEEAST]		= true;
		break;
	case ZONE_VERINEAST:		
		m_sName	= "Verin Colonies East";		m_eiTextureIndex						= TEX_VERINEAST;	
		m_iaAfrThreshes[AFR_WALLSUP]		= 50;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 10;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 30;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 00;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 0;	m_iaAfrThreshes[AFR_VACCINE]		= 10;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 60;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 40;	m_iMilitantMight=10; m_iScienceMight= 20;
		m_bInfectables[ZONE_VERINCENTER]	= true;	m_bInfectables[ZONE_KHATOUM]		= true;
		m_bInfectables[ZONE_MARIANIYAH]		= true;	m_bInfectables[ZONE_KAJHTAI]		= true;
		break;
	case ZONE_VERINCENTER:		
		m_sName	= "Verin Capital";					m_eiTextureIndex					= TEX_VERINCENTER;	
		m_iaAfrThreshes[AFR_WALLSUP]		= 10;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 10;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 10;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 10;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 10;	m_iaAfrThreshes[AFR_VACCINE]		= 10;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 10;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 50;	m_iMilitantMight=20; m_iScienceMight= 30;
		m_bInfectables[ZONE_VERINEAST]		= true;	m_bInfectables[ZONE_VERINWEST]		= true;	
		break;
	case ZONE_NEGEWEST:			
		m_sName	= "Tor Nege";						m_eiTextureIndex = 	TEX_NEGEWEST;		
		m_iaAfrThreshes[AFR_WALLSUP]		= 80;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 80;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 0;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 20;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 40;	m_iaAfrThreshes[AFR_VACCINE]		= 50;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 10;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 20;	m_iMilitantMight=10; m_iScienceMight= 15;
		m_bInfectables[ZONE_AEMPIS]			= true;	m_bInfectables[ZONE_NEGEEAST]		= true;
		break;
	case ZONE_NEGEEAST:			
		m_sName	= "Sier Nege";						m_eiTextureIndex = 	TEX_NEGEEAST;		
		m_iaAfrThreshes[AFR_WALLSUP]		= 30;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 30;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 20;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 20;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 20;	m_iaAfrThreshes[AFR_VACCINE]		= 20;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 10;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 40;	m_iMilitantMight=20; m_iScienceMight= 20;
		m_bInfectables[ZONE_AEMPIS]			= true;	m_bInfectables[ZONE_NEGEWEST]		= true;
		m_bInfectables[ZONE_SANKT]			= true;	m_bInfectables[ZONE_VERINWEST]		= true;
		break;
	case ZONE_MARIANIYAH:	
		m_bInfected = true;							m_iPopInfected = 10;//Disease starts here, naturally
		m_sName	= "Marianiyan Territories";			m_eiTextureIndex					= TEX_MARIANIYAH;	 	
		m_iaAfrThreshes[AFR_WALLSUP]		= 80;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 00;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 80;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 80;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 80;	m_iaAfrThreshes[AFR_VACCINE]		= 80;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 10;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 30;	m_iMilitantMight=10; m_iScienceMight= 10;
		m_bInfectables[ZONE_VERINEAST]		= true;	m_bInfectables[ZONE_KAJHTAI]		= true;
		m_bInfectables[ZONE_AEMPIS]			= true;	m_bInfectables[ZONE_VALUSERRH]		= true;
		break;
	case ZONE_SIASYA:			
		m_sName	= "Siasya";						m_eiTextureIndex = 	TEX_SIASYA;			
		m_iaAfrThreshes[AFR_WALLSUP]		= 30;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 30;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 30;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 30;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 30;	m_iaAfrThreshes[AFR_VACCINE]		= 30;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 30;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 30;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 30;	m_iMilitantMight=15; m_iScienceMight= 40;
		m_bInfectables[ZONE_MARIANIYAH]		= true;	m_bInfectables[ZONE_AEMPIS]			= true;
		m_bInfectables[ZONE_SANKT]			= true;	
		break;
	case ZONE_SANKT:			
		m_sName	= "Sankt";						m_eiTextureIndex = 	TEX_SANKT;			
		m_iaAfrThreshes[AFR_WALLSUP]		= 20;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 50;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 10;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 20;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 10;	m_iaAfrThreshes[AFR_VACCINE]		= 10;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 70;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 70;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 70;	m_iMilitantMight=10; m_iScienceMight= 70;
		m_bInfectables[ZONE_SIASYA]			= true;	m_bInfectables[ZONE_AEMPIS]			= true;
		m_bInfectables[ZONE_NEGEEAST]		= true;	m_bInfectables[ZONE_VERINWEST]		= true;

		break;
	case ZONE_VALUSERRH:	
		m_sName	= "Valuser'rh";					m_eiTextureIndex = 	TEX_VALUSERRH;		
		m_iaAfrThreshes[AFR_WALLSUP]		= 00;	m_iaAfrThreshes[AFR_MARTIALLAW]		= 10;
		m_iaAfrThreshes[AFR_MASKHANDOUTS]	= 10;	m_iaAfrThreshes[AFR_WATERHANDOUTS]	= 10;
		m_iaAfrThreshes[AFR_BROADCASTS]		= 20;	m_iaAfrThreshes[AFR_VACCINE]		= 20;	
		m_iaAfrThreshes[AFR_EX_INSECTS]		= 10;	m_iaAfrThreshes[AFR_EX_ANIMALS]		= 30;
		m_iaAfrThreshes[AFR_EX_INFECTED]	= 40;	m_iMilitantMight=60; m_iScienceMight= 50;
		m_bInfectables[ZONE_MARIANIYAH]	= true;	m_bInfectables[ZONE_AEMPIS]		= true;
		m_bInfectables[ZONE_VALDUTAN]	= true;	m_bInfectables[ZONE_KAJHTAI]	= true;
		break;
	}

	for(int i(0); i < AFFAIR_SIZE;i++)		{m_ebaAffairs[i] = false;}
	for(int i(0); i < SERVICE_SIZE;i++)		{m_ebaServices[i] = true;}
	for(int i(0); i < AFFLICT_SIZE;i++)	{m_ebaAfflictions[i] = false;}

};
//=====MUTATORS
void Zone::UpdateOutputText(string &Text)
{
	ostringstream S;
	S.str("");
	S << endl;
	S << "  Region: " << m_sName <<endl;
	S << "  Total Population   : " << m_iPopTotal		<< endl;
	S << "  Healthy Population : " << m_iPopHealthy		<< endl;
	S << "  Infected Population: " << m_iPopInfected	<< endl;
	S << "  Deceased Population: " << m_iPopDead		<< endl;

	S << endl;																			
	(m_ebaAffairs[AFR_WALLSUP]?		 S << "  Walls have been built           " : S << "  Walls have not been built       ");	S << "        ";	
	(m_ebaServices[SER_ROADS]?		 S << "  Roads are Open					 " : S << "  Roads are Closed				 ");	S << endl;
	(m_ebaAffairs[AFR_MARTIALLAW]?	 S << "  Martial Law in effect           " : S << "  Martial Law not in effect       ");	S << "        ";
	(m_ebaServices[SER_RAILS]?		 S << "  Rails are Open                  " : S << "  Rails are Closed                ");	S << endl;
	(m_ebaAffairs[AFR_MASKHANDOUTS]? S << "  Masks being handed out          " : S << "  Masks not being handed out      ");	S << "        ";
	(m_ebaServices[SER_PORTS]?		 S << "  Ports are Open                  " : S << "  Ports are Closed                ");	S << endl;
	(m_ebaAffairs[AFR_WATERHANDOUTS]?S << "  Water being handed out          " : S << "  Water not being handed out      ");	S << "        ";
	(m_ebaServices[SER_HOSPITALS]?	 S << "	 Hospitals Open                  " : S << "  Hospitals Closed                ");	S << endl;
	(m_ebaAffairs[AFR_BROADCASTS]?	 S << "  Emergency Broadcast Active      " : S << "  Normal Scheduled Broadcasts     ");	S << endl;
	(m_ebaAffairs[AFR_VACCINE]?		 S << "  Vaccine being deployed          " : S << "  Vaccine not being deployed      ");	S << "        ";
	(m_ebaAfflictions[AFL_EARTHQUAKE]?S<< "  Earthquakes wrack the country   " : S << "  No Seismic Activity             ");	S << endl;
	(m_ebaAffairs[AFR_EX_INSECTS]?	 S << "  Insects being exterminated      " : S << "  Insects not being exterminated  ");	S << "        ";
	(m_ebaAfflictions[AFL_HURRICANE]?S << "  A hurricane buffets the populace" : S << "	 The weather is calm             ");	S << endl;
	(m_ebaAffairs[AFR_EX_ANIMALS]? 	 S << "  Animals being exterminated      " : S << "  Animals not being exterminated  ");	S << "        ";
	(m_ebaAfflictions[AFL_FLOODING]? S << "	 Floods tear through the streets " : S << "  Water levels are normal         ");	S << endl;
	(m_ebaAffairs[AFR_EX_INFECTED]?  S << "  Citzens being exterminated      " : S << "  Citizens not being exterminated ");    S << endl;
	(m_ebaAfflictions[AFL_RIOTS]?	 S << "  Riots terrorize the population  " : S << "  The citizenry are relatively calm");	S << endl;
	S << endl;
	(m_ebaAfflictions[AFL_MASSCHAOS]?S << "  The land is in sheer pandemonium. What survivors, if any, will recall these days \n",
		S << "  as hell incarnate." : S << "  Things could be worse...");

	Text = S.str();
}
//=====UPDATE
void Zone::Update(int& TotalHealthy, int& TotalInfected, int& TotalDeceased)
{
	if(m_bInfected){

		LocalSpread();
		GlobalSpread();
#ifdef ThisIsHard
		ChooseReaction();
		React();
#endif
		FlattenValues();
	}

	ChangeZoneColor();
	TotalHealthy	+= m_iPopHealthy;
	TotalInfected	+= m_iPopInfected;
	TotalDeceased	+= m_iPopDead;
}
void Zone::LocalSpread()
{
	if(!m_bForsaken){												//If: The Zone is not Dead
		if(!m_bSuccumbed){											//If: The Zone has not succumbed
			m_iPopInfected += Pathogen::Into()->iGetVir();			//Spread the infection among the population
			m_iPopHealthy  -= Pathogen::Into()->iGetVir();			//Stop counting the infected as healthy
		}//End:if(!m_bSuccumbed)
		m_iPopDead		+= Pathogen::Into()->CheckLethality();		//Kill people
		m_iPopInfected	-= Pathogen::Into()->CheckLethality();		//Don't count those people as infected
	}//End:if(!m_bForsaken) 
};
void Zone::React()
{
	if(m_bInfected && !m_bForsaken){
		if(m_ebaAffairs[AFR_EX_INFECTED])
		{
			m_iPopInfected	-= m_iMilitantMight;
			m_iPopDead		+= m_iMilitantMight;
		}
		if(m_ebaAffairs[AFR_VACCINE])
		{
			m_iPopInfected	-= m_iScienceMight;
			m_iPopDead		+= m_iScienceMight;
		}
	}
};
void Zone::GlobalSpread()
{
	for(int i(0); i < ZONE_SIZE; i++)									//For: Every Possible Zone.
		if(Pathogen::Into()->iGetVir())									//If:  The Pathogen has virulence.
			if(m_bInfectables[i] == true)								//If:  The [i] country can be reached.
				if(!Engine::Into()->isZoneInfected(i))					//If:  The [i] country isn't infected.
					if(((rand()%100000)/Pathogen::Into()->iGetVir())== 1) //If:  With modifiers, we roll a 1.
						Engine::Into()->InfectNewZone(i);				//Do:  Tell the Engine to infect [i].
};
void Zone::ChooseReaction()
{
	float InfectedPercent	= ((float)m_iPopInfected*100)	/(m_iPopStart);
	float KilledPercent		= ((float)m_iPopDead*100)		/(m_iPopStart); 

	//=====CHECK TO SEE IF WE EXTERMINATE THE INFECTED
	if(m_bInfected && !m_bForsaken && !m_ebaAffairs[AFR_EX_INFECTED]){
		if(InfectedPercent > m_iaAfrThreshes[AFR_EX_INFECTED])
		{
			m_ebaAffairs[AFR_EX_INFECTED] = true;
			Engine::Into()->PostResistorMessage(m_sName);
		} 
	}
	if(m_iPopInfected <= 0 && m_ebaAffairs[AFR_EX_INFECTED]){
		m_bInfected = false;
		m_ebaAffairs[AFR_EX_INFECTED] = false;
		Engine::Into()->DisinfectZone(m_eiCountryID);
		Engine::Into()->PostExterminMessage(m_sName);
	}

	//=====CHECK TO SEE IF WE VACCINATE THE INFECTED
	if(m_bInfected && !m_bForsaken && !m_ebaAffairs[AFR_VACCINE]){
		if(InfectedPercent > m_iaAfrThreshes[AFR_VACCINE])
		{
			m_ebaAffairs[AFR_VACCINE] = true;
			Engine::Into()->PostVaccinatMessage(m_sName);
		} 
	}
	if(m_iPopInfected <= 0 && m_ebaAffairs[AFR_VACCINE]){
		m_bInfected = false;
		m_ebaAffairs[AFR_VACCINE] = false;

		Engine::Into()->DisinfectZone(m_eiCountryID);
		Engine::Into()->PostExterminMessage(m_sName);
	}


}
void Zone::ChangeZoneColor()
{
	int InfectedPercent = (255-((m_iPopInfected*255)/(m_iPopStart)));
	int KilledPercent	= (255-((m_iPopDead*255) /(m_iPopStart))); 

	if(m_bInfected && !m_bSuccumbed)
		PhaseToYellow(InfectedPercent,KilledPercent);
	if(m_bInfected && m_bSuccumbed)
		PhaseToRed(KilledPercent);
	if(m_bForsaken)
		PhaseToBlack(10);
}
void Zone::FlattenValues()
{
	m_iPopHealthy = m_iPopStart -(m_iPopInfected + m_iPopDead);
	m_iPopTotal	  = m_iPopInfected + m_iPopHealthy;			//Count the new population of the country
	

	if(m_iPopHealthy < 0 && !m_bSuccumbed){					//If: No more healthy citizens
		m_bSuccumbed = true;								//This country has succumbed to the infection
		m_iPopHealthy = 0;									//Default the healthy to 0, for display purposes
		Engine::Into()->PostCrippledMessage(m_sName);
	}

	if(m_iPopInfected <= 0)									//If there are no infected citizens here..		
	{
		m_iPopInfected = 0;									//Set so the player doesn't see a negative #
		m_bInfected = false;
		Engine::Into()->DisinfectZone(m_eiCountryID);
	}

	if(m_iPopTotal < 0 && !m_bForsaken){									//If there are no citizens here whatsoever..			
		m_iPopTotal		= 0;								//Set so the player doesn't see a negative #		
		m_iPopInfected = 0;
		m_bForsaken	= true;									//The world will forsake this zone
		m_bInfected = false;
		Engine::Into()->DisinfectZone(m_eiCountryID);
		Engine::Into()->PostForsakenMessage(m_sName);
	}

}

